package com.example.spring_test2.dao;

import com.example.spring_test2.domain.Product;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Mapper
public interface productDao {
    @Select("select * from product")
    public List<Product> getAllProduct();

    @Select("select * from product where id=#{id}")
    public Product getProductById(long id);

    @Insert("insert into product (id,name,price,stock,description) values (#{id},#{name},#{price},#{stock},#{description})")
    public void addProduct(Product product);

    @Delete("delete from product where id=#{id}")
    public void deleteProduct(long id);

    @Update("update product set name=#{name},price=#{price},stock=#{stock},description=#{description} where id=#{id}")
    public void updateProduct(Product product);
}
//    private Long id;
//    private String name;
//    private Double price;
//    private Integer stock;
//    private String description;